import tvm
import numpy as np

def test_get_global():
    targs = (10, 20, 30)
    # register into global function table

    @tvm.register_func
    def my_packed_func(*args):
        return np.sum(args)

    mysum = tvm.get_global_func("my_packed_func")
    assert isinstance(mysum, tvm.runtime.PackedFunc)
    y = mysum(*targs)
    print(y)

def test_packed_func():
    @tvm.register_func
    def print_msg(msg):
        print(msg)

    f = tvm.get_global_func("print_msg")
    f("PackedFunc Test")

test_get_global()
test_packed_func()
